import React from "react"
import NotFound from "./404"
import { Navigate } from "react-router-dom"

// lazy函数接受一个promise，而不是直接import 'xxx',这样是同步.import('abc')甚至可以调用.then方法
const UseTransition = React.lazy(() => import("@/page/useTransition"))
const UseDeferredValue = React.lazy(() => import("@/page/useDeferredValue"))
const routes = [
  {
    path: "/",
    element: <Navigate to="/UseDeferredValue" />
  },

  {
    path: "/UseTransition",
    element: <UseTransition />
  },
  {
    path: "/UseDeferredValue",
    element: <UseDeferredValue />
  },
  {
    path: "*",
    element: <NotFound />
  }
]

export default routes
